package file;

import java.io.File;

public class ListFilesDemo {
    public static void main(String[] args) {
        File dir = new File(".");
        if (dir.isDirectory()) {
            System.out.println("是一个目录");
            File[] subs=  dir.listFiles();
            for (File sub : subs) {
                System.out.println(sub.getName());
            }
        }else {
            System.out.println("不是一个目录");
        }
    }
}
